package com.calvin.study.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebInterceptor implements WebMvcConfigurer {
	
	@Autowired
	private LoginInterceptor loginInterceptor;
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// 给当前应用添加拦截器，从Spring IoC容器中获取到
		// 表示拦截/order下面所有的资源
		registry.addInterceptor(loginInterceptor).addPathPatterns("/order/*");
	}

}
